package homelesspartners.client.widgets;

import homelesspartners.client.Controller;
import homelesspartners.client.Index;
import homelesspartners.client.model.City;
import homelesspartners.client.model.User;

import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.Widget;


public class CityWidget extends Composite {

	private City city = null;
	
	public CityWidget(City aCity) {
		city = aCity;
		Hyperlink cityLink = new Hyperlink(city.getName(), "");
		cityLink.setStylePrimaryName("city");
		cityLink.addClickListener(new ClickListener() {

			public void onClick(Widget sender) {
				Index.selectTab(1);
				User.getInstance().setCurrentCity(getCity());
				Controller.doCityWidgetClicked();
			}
		});
		initWidget(cityLink);
	}

	protected City getCity() {
		return city;
	}
	
	

}
